#include						"UdpServer.h"
#include						"RotatingBuffer.h"
#include						"ASocket.h"

UdpServer::UdpServer(PacketHandler *packet) : _packet(packet)
{
	_socket.setHandler(packet);
	_socket.init();
}

UdpServer::~UdpServer()
{
}

void							UdpServer::connectToClient(const std::string &ip, const std::string &port)
{
	_socket.connectToHost(ip, port);
}

void							UdpServer::sendPacket(Packet *packet, QHostAddress &ip, quint16 port)
{
	_socket.sendPacket(packet, ip, port);
}

void							UdpServer::disconnect(unsigned int id)
{
/*	for (std::list<QtAsyncUdpSocket*>::iterator it = _socket.begin(); it != _socket.end();)
	{
		delete *it;
		it = _socket.erase(it);
	}*/
}